<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="/Static/Css/reset.css" />
<link rel="stylesheet" type="text/css" href="/Static/Css/zh-cn-system.css" />
<link rel="stylesheet" type="text/css" href="/Static/Css/table_form.css" />
<script src="/Public/js/jquery.min.js"></script>
<script src="/Public/js/jquery.form.js"></script>
<script src="/Public/js/main.js"></script>
<script type="text/javascript" src="/Public/artDialog/jquery.artDialog.js?skin=default"></script>
<script type="text/javascript" src="/Public/artDialog/plugins/iframeTools.js"></script>
</head>
<body>

<div class="subnav">
  <div class="explain-col" style="position: relative;">
    <form name="searchForm" id="searchForm" method="get" action="/index.php/Admin/index">
      搜索：
      <input type="text" name="keyword" id="keyword" size="20"  value="" class="input-text" placeholder="请输入关键词" />
      <select name="role_id" id="role_id" onchange="searchForm.submit()">
        <option value="0">所属分组</option>
        <?php $_result=get_role_list();if(is_array($_result)): $i = 0; $__LIST__ = $_result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><option value="<?php echo ($vo["id"]); ?>"  ><?php echo ($vo["name"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
      </select>
      <input type="submit" value=" 搜索 " class="button" />
    </form>
    <div class="content-menu" style="position: absolute; right: 30px;top: 5px;"> <a href="javascript:openWinBox('/index.php/admin/add','添加用户');" class="add fb"><em>添加用户</em></a> </div>
  </div>
</div>
<!--subnav-->
<div class="pad-lr-10">
  <form name="myform" id="myform" action="" method="post">
    <div class="table-list">
      <table width="100%" cellspacing="0">
        <thead>
          <tr>
            <th width="50" align="center">ID</th>
            <th align="left">用户名</th>
            <th align="left">所属角色</th>
            <th align="center">上次登录时间</th>
            <th align="left">上次登录IP</th>
            <th align="center" width="50">启用状态</th>
            <th align="center">创建时间</th>
            <th align="center" >操作</th>
          </tr>
        </thead>
        <tbody  id="list">
          <?php if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><tr id="list-<?php echo ($vo["id"]); ?>">
              <td align="center"><?php echo ($vo["id"]); ?></td>
              <td align="left"><?php echo ($vo["username"]); ?></td>
              <td align="left"><?php echo (get_role_name($vo["role_id"])); ?></td>
              <td align="center"><?php echo ($vo["last_login_time"]); ?></td>
              <td align="left"><?php echo ($vo["last_login_ip"]); ?></td>
              <td align="center"><?php echo (statusArr($vo["status"])); ?></td>
              <td align="center"><?php echo ($vo["create_time"]); ?></td>
              <td align="center">
                  <?php if(($vo["id"]) != "1"): ?>【<a href="javascript:openWinBox('/index.php/admin/add/id/<?php echo ($vo["id"]); ?>','修改',800,400)" >修改</a>】
                  【<a href="javascript:delConfirm('<?php echo ($vo["id"]); ?>');" >删除</a>】<?php endif; ?>
              </td>
            </tr><?php endforeach; endif; else: echo "" ;endif; ?>
        </tbody>
      </table>
    </div>
  </form>
</div>
</body></html>
<script type="text/javascript">
$(document).ready(function(e) {
	var role_id = "<?php echo ($_GET['role_id']); ?>";
	$("#role_id").val(role_id);

	$("#group_id").change(function(){
		$("#searchForm").submit();
	})

	$("#keyword").change(function(){
		$("#searchForm").submit();
	})
	/*$(".del").click(function(){
		var id = $(this).attr('name');
		alert(id);
	})*/
});

function delConfirm(id){
	art.dialog({content: '确定删除所选数据吗？',ok: function () { del(id); return true; },cancelVal: '取消',cancel: true});
}

function del(id){
	jQuery.get('/index.php/admin/del',encodeURI('ids='+id),success,'json');
	function success(data){
		if(data.status==1){
			window.top.art.dialog({id:'TNCICC',content: data.info,time: 1,icon:'succeed'});
			$("#list-"+id).remove();
			setTimeout(function(){closeWin(1000);},1000);
		}else{
			window.top.art.dialog({id:'TNCICC',content: data.info,time: 1,icon:'warning'});
		}
	}
}

</script>